package com.dzsw.e2p.sample;

import java.awt.*;
import java.io.IOException;
import java.util.ArrayList;

public class Excel2PdfMain {

    public static void main(String[] args) throws IOException {
        PdfTable table = new PdfTable();
        table.setRows(new ArrayList<>());
        table.setFont("fonts/MS-PGothic.ttf");

        Color titleColor = new Color(3, 110, 184);
        Color backGray = new Color(242, 242, 242);


        PdfRow row = PdfRow.builder()
                .height(0)
                .pdfColumns(new ArrayList<>())
                .build();
        row.addColumn(PdfColumn.builder().columnImage(PdfColumnImage
                        .builder()
                        .image("cat.png")
                        .x(454)
                        .y(754)
                        .width(102.5F)
                        .height(73.75F)
                        .build())
                .build());
        table.addRow(row);

        PdfRow row1 = PdfRow.builder().height(30).pdfColumns(new ArrayList<>()).build();
        row1.addColumn(PdfColumn.builder().name("XXXXX").width(300).fontSize(20).offset(97.5F).block(true).build());
        table.addRow(row1);

        PdfRow row2 = PdfRow.builder().height(30).pdfColumns(new ArrayList<>()).build();
        row2.addColumn(PdfColumn.builder().name("XXX:").width(72).textColor(titleColor).autoWidth(true).block(true).align(HorizontalAlignment.LEFT).build());
        row2.addColumn(PdfColumn.builder().name("XXXXX").align(HorizontalAlignment.LEFT).build());

        table.addRow(row2);

        PdfRow row3 = PdfRow.builder().height(30).pdfColumns(new ArrayList<>()).build();
        row3.addColumn(PdfColumn.builder().name("AAAAAAAAAAAAAA").textColor(titleColor).block(true).align(HorizontalAlignment.LEFT).build());
        table.addRow(row3);

        PdfRow row4 = PdfRow.builder().height(18).pdfColumns(new ArrayList<>()).build();
        row4.addColumn(PdfColumn.builder().name("AAAAAAAA").align(HorizontalAlignment.LEFT).width(99).build());
        row4.addColumn(PdfColumn.builder().name("XXXXXXXX").align(HorizontalAlignment.LEFT).width(99).build());
        row4.addColumn(PdfColumn.builder().name("XXXXXXXXXX").align(HorizontalAlignment.LEFT).width(99).build());
        row4.addColumn(PdfColumn.builder().name("XXXXXXXXX").align(HorizontalAlignment.LEFT).width(99).build());
        row4.addColumn(PdfColumn.builder().name("XXXXXXXXXX").align(HorizontalAlignment.LEFT).width(99).build());
        table.addRow(row4);

        PdfRow row5 = PdfRow.builder().height(18).pdfColumns(new ArrayList<>()).build();
        row5.addColumn(PdfColumn.builder().name("XXXXXXXXXXXXXXXXXXXXX").align(HorizontalAlignment.LEFT).build());

        table.addRow(row5);

        PdfRow row6 = PdfRow.builder().height(30).pdfColumns(new ArrayList<>()).build();
        row6.addColumn(PdfColumn.builder().name("XXXXXXXXXXXXXXXXXXX").textColor(titleColor).block(true).align(HorizontalAlignment.LEFT).build());
        table.addRow(row6);

        PdfRow row7 = PdfRow.builder().height(18).pdfColumns(new ArrayList<>()).build();
        row7.addColumn(PdfColumn.builder().name("XXXXXXXXXXXXXXX").width(154).align(HorizontalAlignment.LEFT).build());
        row7.addColumn(PdfColumn.builder().name("XXXXXXXXXXXXXXXXXXXXXXXXX").width(154).align(HorizontalAlignment.LEFT).build());
        table.addRow(row7);

        PdfRow row8 = PdfRow.builder().height(30).pdfColumns(new ArrayList<>()).build();
        row8.addColumn(PdfColumn.builder().name("XXXXXXXXXXXXXXX").textColor(titleColor).block(true).align(HorizontalAlignment.LEFT).build());
        table.addRow(row8);

        PdfRow row10 = PdfRow.builder().height(18).pdfColumns(new ArrayList<>()).build();
        row10.addColumn(PdfColumn.builder().name("XXXXXXXX").block(true).align(HorizontalAlignment.LEFT).build());
        table.addRow(row10);

        PdfRow row11 = PdfRow.builder().height(18).pdfColumns(new ArrayList<>()).build();
        row11.addColumn(PdfColumn.builder().name("XXXXXXXXXX").width(100).align(HorizontalAlignment.LEFT).build());
        row11.addColumn(PdfColumn.builder().name("XXXXXXXXXXX").width(100).align(HorizontalAlignment.LEFT).build());
        table.addRow(row11);

        PdfRow row12 = PdfRow.builder().height(18).pdfColumns(new ArrayList<>()).build();
        row12.addColumn(PdfColumn.builder().name("XXXXXXXXXXXX").width(100).align(HorizontalAlignment.LEFT).build());
        row12.addColumn(PdfColumn.builder().name("XXXXXXX").width(100).align(HorizontalAlignment.LEFT).build());
        row12.addColumn(PdfColumn.builder().name("XXXXXXX").width(100).align(HorizontalAlignment.LEFT).build());
        row12.addColumn(PdfColumn.builder().name("XXXXX").width(100).align(HorizontalAlignment.LEFT).build());
        table.addRow(row12);
        table.addRow(row12);
        table.addRow(row12);
        table.addRow(row12);
        table.addRow(row12);
        table.addRow(row12);
        table.addRow(row12);
        table.addRow(row12);
        table.addRow(row12);
        table.addRow(row12);
        table.addRow(row12);
        table.addRow(row12);
        table.addRow(row12);
        table.addRow(row12);


        PdfRow row20 = PdfRow.builder().height(30).pdfColumns(new ArrayList<>()).build();
        row20.addColumn(PdfColumn.builder().name("xxxxxxxxxxxxx").textColor(titleColor).block(true).align(HorizontalAlignment.LEFT).build());
        table.addRow(row20);

        PdfRow row21 = PdfRow.builder().height(18).pdfColumns(new ArrayList<>()).build();
        row21.addColumn(PdfColumn.builder().name("xxxx").block(true).offset(200).width(48).align(HorizontalAlignment.CENTER).backGround(backGray).build());
        row21.addColumn(PdfColumn.builder().name("xxxx").block(true).width(48).align(HorizontalAlignment.CENTER).build());
        row21.addColumn(PdfColumn.builder().name("xxxx").block(true).width(48).align(HorizontalAlignment.CENTER).backGround(backGray).build());
        row21.addColumn(PdfColumn.builder().name("xxxx").block(true).width(48).align(HorizontalAlignment.CENTER).build());
        row21.addColumn(PdfColumn.builder().name("xxxx").block(true).width(48).align(HorizontalAlignment.CENTER).backGround(backGray).build());
        row21.addColumn(PdfColumn.builder().name("xxxx").block(true).width(48).align(HorizontalAlignment.CENTER).build());
        row21.addColumn(PdfColumn.builder().name("xxxx").block(true).width(48).align(HorizontalAlignment.CENTER).backGround(backGray).build());
        table.addRow(row21);

        PdfRow row22 = PdfRow.builder().downBorder(true).borderStyle(BorderStyle.SOLID).height(18).pdfColumns(new ArrayList<>()).build();
        row22.addColumn(PdfColumn.builder().name("xxx").block(true).offset(200).width(48).align(HorizontalAlignment.CENTER).backGround(backGray).build());
        row22.addColumn(PdfColumn.builder().name("xxx").block(true).width(48).align(HorizontalAlignment.CENTER).build());
        row22.addColumn(PdfColumn.builder().name("xxxxx").block(true).width(48).align(HorizontalAlignment.CENTER).backGround(backGray).build());
        row22.addColumn(PdfColumn.builder().name("xxxxx").block(true).width(48).align(HorizontalAlignment.CENTER).build());
        row22.addColumn(PdfColumn.builder().name("xxxxx").block(true).width(48).align(HorizontalAlignment.CENTER).backGround(backGray).build());
        row22.addColumn(PdfColumn.builder().name("xxxxx").block(true).width(48).align(HorizontalAlignment.CENTER).build());
        row22.addColumn(PdfColumn.builder().name("xxxxx").block(true).width(48).align(HorizontalAlignment.CENTER).backGround(backGray).build());
        table.addRow(row22);

        PdfRow row23 = PdfRow.builder().downBorder(true).borderStyle(BorderStyle.DOTTED).height(18).pdfColumns(new ArrayList<>()).build();
        row23.addColumn(PdfColumn.builder().name("xxxxxx").block(true).width(200).align(HorizontalAlignment.LEFT).build());
        row23.addColumn(PdfColumn.builder().name("").width(48).align(HorizontalAlignment.CENTER).backGround(backGray).build());
        row23.addColumn(PdfColumn.builder().name("").width(48).align(HorizontalAlignment.CENTER).build());
        row23.addColumn(PdfColumn.builder().name("").width(48).align(HorizontalAlignment.CENTER).backGround(backGray).build());
        row23.addColumn(PdfColumn.builder().name("").width(48).align(HorizontalAlignment.CENTER).build());
        row23.addColumn(PdfColumn.builder().name("").width(48).align(HorizontalAlignment.CENTER).backGround(backGray).build());
        row23.addColumn(PdfColumn.builder().name("").width(48).align(HorizontalAlignment.CENTER).build());
        row23.addColumn(PdfColumn.builder().name("").width(48).align(HorizontalAlignment.CENTER).backGround(backGray).build());
        table.addRow(row23);

        PdfRow row24 = PdfRow.builder().downBorder(true).borderStyle(BorderStyle.DOTTED).height(18).pdfColumns(new ArrayList<>()).build();
        row24.addColumn(PdfColumn.builder().name("xxxxxxx").offset(20).width(180).align(HorizontalAlignment.LEFT).build());
        row24.addColumn(PdfColumn.builder().name("xxxx").width(48).align(HorizontalAlignment.CENTER).backGround(backGray).build());
        row24.addColumn(PdfColumn.builder().name("xxxx").width(48).align(HorizontalAlignment.CENTER).build());
        row24.addColumn(PdfColumn.builder().name("xxxx").width(48).align(HorizontalAlignment.CENTER).backGround(backGray).build());
        row24.addColumn(PdfColumn.builder().name("xxxx").width(48).align(HorizontalAlignment.CENTER).build());
        row24.addColumn(PdfColumn.builder().name("xxxx").width(48).align(HorizontalAlignment.CENTER).backGround(backGray).build());
        row24.addColumn(PdfColumn.builder().name("xxxx").width(48).align(HorizontalAlignment.CENTER).build());
        row24.addColumn(PdfColumn.builder().name("xxxx").width(48).align(HorizontalAlignment.CENTER).backGround(backGray).build());
        table.addRow(row24);

        PdfRow row25 = PdfRow.builder().downBorder(true).borderStyle(BorderStyle.DOTTED).height(18).pdfColumns(new ArrayList<>()).build();
        row25.addColumn(PdfColumn.builder().name("xxxxxxxxxxxxx").offset(20).width(180).align(HorizontalAlignment.LEFT).build());
        row25.addColumn(PdfColumn.builder().name("xxx").width(48).align(HorizontalAlignment.CENTER).backGround(backGray).build());
        row25.addColumn(PdfColumn.builder().name("xxx").width(48).align(HorizontalAlignment.CENTER).build());
        row25.addColumn(PdfColumn.builder().name("xxx").width(48).align(HorizontalAlignment.CENTER).backGround(backGray).build());
        row25.addColumn(PdfColumn.builder().name("xxx").width(48).align(HorizontalAlignment.CENTER).build());
        row25.addColumn(PdfColumn.builder().name("xxx").width(48).align(HorizontalAlignment.CENTER).backGround(backGray).build());
        row25.addColumn(PdfColumn.builder().name("xxx").width(48).align(HorizontalAlignment.CENTER).build());
        row25.addColumn(PdfColumn.builder().name("xxx").width(48).align(HorizontalAlignment.CENTER).backGround(backGray).build());
        table.addRow(row25);


        table.addRow(row23);
        table.addRow(row24);
        table.addRow(row25);

        table.addRow(row23);
        table.addRow(row24);
        table.addRow(row25);

        table.addRow(row23);
        table.addRow(row24);
        table.addRow(row25);

        table.addRow(row23);
        table.addRow(row24);
        table.addRow(row25);

        table.addRow(row23);
        table.addRow(row24);
        table.addRow(row25);

        table.addRow(row23);
        table.addRow(row24);
        table.addRow(row25);

        table.addRow(row23);
        table.addRow(row24);
        table.addRow(row25);

        table.addRow(row23);
        table.addRow(row24);
        table.addRow(row25);

        table.addRow(row23);
        table.addRow(row24);
        table.addRow(row25);

        table.addRow(row23);
        table.addRow(row24);
        table.addRow(row25);

        table.addRow(row23);
        table.addRow(row24);
        table.addRow(row25);

        table.addRow(row23);
        table.addRow(row24);
        table.addRow(row25);

        table.addRow(row23);
        table.addRow(row24);
        table.addRow(row25);

        table.addRow(row23);
        table.addRow(row24);
        table.addRow(row25);

        table.addRow(row23);
        table.addRow(row24);
        table.addRow(row25);

        table.addRow(row23);
        table.addRow(row24);
        table.addRow(row25);

        table.addRow(row23);
        table.addRow(row24);
        table.addRow(row25);

        table.addRow(row23);
        table.addRow(row24);
        table.addRow(row25);

        table.addRow(row23);
        table.addRow(row24);
        table.addRow(row25);

        table.addRow(row23);
        table.addRow(row24);
        table.addRow(row25);

        DrawTableUtils.createDocument(table);
    }
}
